{{extend './_member_layout.html'}}

{{block 'title'}}{{ title }}{{/block}}

{{block 'head'}}
<!-- Bootstrap core CSS -->
<link href="/public/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="/public/css/dashboard.css" rel="stylesheet">
{{/block}}

{{block 'content'}}
<div class="container-fluid">
  {{include './_member_left.html'}}
  <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h3><small>幻灯片管理</small></h3>
    <hr>
    <form class="form-horizontal">
      <div class="form-group">
        <label for="title" class="col-sm-2 control-label">标题</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="title" name="title" placeholder="请输入标题">
        </div>
      </div>
      <div class="form-group">
        <label for="linkurl" class="col-sm-2 control-label">链接地址</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="linkurl" name="linkurl" placeholder="请输入链接地址">
        </div>
      </div>
      <div class="form-group">
        <label for="inputPassword3" class="col-sm-2 control-label">状态</label>
        <div class="col-sm-10">
          <label class="radio-inline">
            <input type="radio" name="state" id="inlineRadio1" checked value="1"> 启用
          </label>
          <label class="radio-inline">
            <input type="radio" name="state" id="inlineRadio2" value="0"> 禁用
          </label>
        </div>
      </div>
      <div class="form-group">
        <label for="image" class="col-sm-2 control-label">图片</label>
        <div class="col-sm-10">
          <input type="file" id="image" name="image">
        </div>
        <p class="help-block">图片大小：400*300px</p>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button type="submit" id="btnSubmit" class="btn btn-primary">提交</button>
        </div>
      </div>
    </form>
  </div>
</div>
<script src="/public/js/jquery-1.8.3.min.js"></script>
<script>
  $('form').submit(function (e) {
    e.preventDefault()
    var fd = new FormData(this)
    $.ajax({
      url: "/admin/banners/add",
      type: "post",
      datatype: 'json',
      data: fd,
      cache: false,
      processData: false,
      contentType: false,
      success: function (data) {
        console.log(data)
      }, error: function (err) {
        console.error(err)
      }
    });
  })
</script>
{{/block}}